Repository navigation
Conversation
Empty commit to open the draft PR that carries the plan. The implementation follows in later commits. 👾 Generated with [Letta Code](https://letta.com) Co-Authored-By: Letta Code <noreply@letta.com>
Graph's generated OpenAPI document declares a JSON onenotePage body
for POST .../onenote/.../pages. Graph accepts only raw text/html or
multipart/form-data with a Presentation part, and rejects JSON with
HTTP 415. The same document omits the documented PATCH page update
on .../pages/{id}/content and declares an octet-stream PUT instead.
The Graph adapter now corrects these path items in
microsoftGraphKeepPathItem, next to the existing octet-stream
response normalization:
1. Page create takes text/html (first, so it is the default) or
multipart/form-data with a required text/html Presentation part.
2. Page content gains PATCH with a JSON array of patch commands and a
204 response. Its operationId derives from the GET operationId, and
its permissions come from the generated PUT.
3. The generated PUT stays callable for existing callers, but is
marked deprecated and loses its link to the PATCH-only docs, so
tool selection prefers the documented update.
The slice generator and the runtime compile share this function, so
new slices carry the fix, and an integration that refreshes its spec
gets corrected tools even from a slice published before the fix.
Non-OneNote paths and the onenotePatchContent action are unchanged.
👾 Generated with [Letta Code](https://letta.com)
Co-Authored-By: Letta Code <noreply@letta.com>
The first version kept a declared PATCH on page content unchanged. A declared PATCH can carry a generated OData shape, so the documented contract now always applies. A declared operationId is kept, so its tool name stays stable and a second pass stays identical. 👾 Generated with [Letta Code](https://letta.com) Co-Authored-By: Letta Code <noreply@letta.com>
A multipart page create can carry files in parts that the page HTML references by name. The invoker already sends a ToolFile value under any part name as a file part, so the test now covers that, and the request body description tells callers to pass files that way. 👾 Generated with [Letta Code](https://letta.com) Co-Authored-By: Letta Code <noreply@letta.com>
A declared PATCH could carry a read-only scope, and the corrected update kept it when the path had no PUT. Permissions now come only from the generated PUT. The PATCH description also covers the delete action, which takes no content. 👾 Generated with [Letta Code](https://letta.com) Co-Authored-By: Letta Code <noreply@letta.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The generated Microsoft Graph OpenAPI document declares the OneNote page write operations with the wrong request contracts:
POST .../onenote/.../pagesdeclares anapplication/jsonmicrosoft.graph.onenotePagebody. Graph rejects JSON for this operation with HTTP 415. The documented contract is a rawtext/htmlbody, ormultipart/form-datawith a requiredPresentationpart (text/html) and optional file parts..../pages/{onenotePage-id}/contentdeclaresGETand an octet-streamPUT. The documented update isPATCHwith anapplication/jsonarray of patch commands and a204response. It is missing.The OpenAPI invoker already serializes
text/html, multipart, and bare-array JSON bodies correctly. Only the spec is wrong.Change
All code is in
packages/plugins/openapi/src/providers/microsoft/graph.ts. It is one more path-item normalization inmicrosoftGraphKeepPathItem, next tonormalizeMicrosoftGraphContentPathItem./me,/users/{id},/groups/{id}, and/sites/{id}, and every nested section form (sections,notebooks/.../sections,sectionGroups/.../sections,notebooks/.../sectionGroups/.../sections, and the rootpagescollection). That is 20 variants.POST .../pages: the request body becomestext/html(first, so it is the default) andmultipart/form-data(Presentationrequired, withtext/htmlpart encoding; other parts are files). Responses, operationId, and permissions stay.PATCH .../pages/{onenotePage-id}/content: a JSON array of{target, action, position?, content?}commands with the documented lowercase enums, and a204response.GEToperationId (...GetPagesContentbecomes...PatchPagesContent). It is unique, and it differs from thePUToperationId.PUT.PATCH, the documented contract still applies, and the declared operationId stays.PUT .../contentstays callable, because no evidence shows that it fails on real pages, and removing it can break callers. It is markeddeprecated, and its link to the PATCH-only update docs is removed, so tool selection prefers the documented update.onenotePatchContentaction does not change.PUT) do not change.How the fix reaches existing integrations
slice-build.ts) and the runtime compile (spec-format-adapter.ts) both usemicrosoftGraphKeepPathItem. New slices carry the correction. A host that runs this code also corrects slices published before the fix when it compiles them.addSpecandupdateSpecstore (backing.ts). Nothing re-normalizes stored bindings later. An existing integration therefore gets the corrected tools, including the newPATCHtool, at its next spec refresh (updateSpec).Tests
packages/plugins/openapi/src/providers/microsoft/onenote.test.tsuses synthetic Graph-shaped fixtures only.text/htmlfirst;PATCHwith write permissions;PUTwith the request body unchanged;PUTunchanged;PATCHgets corrected and keeps its operationId and write-only permissions.onenoteslice has the corrected operations, unique operationIds, and every$refresolves.updateSpec. The test then checks the stored tool schemas and the wire requests:text/html.Presentationpart withContent-Type: text/html, and a file part under its own part name.PATCHsends a bare JSON array to.../pages/{id}/content.Without the
graph.tschange, 4 of the 7 tests fail.The published service emulators have no OneNote surface. The runtime test therefore serves the fixture and captures requests through an in-memory
HttpClient, as the other Graph adapter tests do.Checks
bun run format:check: pass.bun run lint: pass.vitest runinpackages/plugins/openapi: 53 files and 344 tests pass, plus the new file.bun run typecheck:@executor-js/plugin-openapihas no errors.@executor-js/desktopfails locally with a vite/rolldown plugin type mismatch inelectron.vite.config.ts, which this change does not touch.bun run test(with--continue):@executor-js/plugin-openapipasses (53 files, 344 tests). Under full parallel load, five packages had failures, all 5-second timeouts or a build input missing in this local checkout:sdk,execution,local,host-cloudflare, andmcp-apps-shell(pretest build). Run alone,execution(79),local(105), andhost-cloudflare(40) pass. The one failingsdkfile passes alone (26). This change does not touch these packages.🤖 Generated with Claude Code
Known limit
The multipart file parts have no fixed names, because the page HTML references them by any part name. The invoker sends a ToolFile value under any part name as a file part, and the test covers this. But the tool input schema does not advertise these extra parts as file inputs, because the extractor rewrites only declared
properties. The request body description tells callers how to pass files. A schema hint would need a generic extractor change, which this PR does not make.Local review record
The local review ran
cubic review -b origin/main -jon a clean tree for each round. The reviewed content matches the pushed content. Base:5d84c5864.a29e5d9f7: P1, a declared PATCH was not corrected. Fixed in7625f6e53.7625f6e53: P2, multipart file parts are not advertised as file inputs. Partly fixed in8f346aeb4: the request body description now tells callers how to pass files, and the wire behavior is tested. The schema hint is deferred (see below).8f346aeb4: P1, the PATCH could take a read-only scope from a declared PATCH. P2, the delete action was not described. Both fixed in4dbb0a91f.4dbb0a91f(pushed head): two findings, both dismissed with evidence.onenotePage-idto.../pages/page-1/content.Accepted deferral: multipart file part schema hint
Presentationonly, and PATCH update are not affected. No data or security risk was found.name="image1"; filename="image1.png"withContent-Type: image/png. The request body description documents the ToolFile input.additionalProperties. That is a generic extraction change, out of proportion to this fix.Out of scope
Graph slicesworkflow.